package com.itheime.homework07;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Student> stuList = new ArrayList<>();
        stuList.add(new Student("张三","男","20","88"));
        stuList.add(new Student("李四","女","19","99"));
        try(
                BufferedWriter bos = new BufferedWriter(new FileWriter("student.txt"));
        ) {
            for (int i = 0; i < stuList.size(); i++) {
                bos.write(stuList.get(i).getName());
                bos.write("，");
                bos.write(stuList.get(i).getSex());
                bos.write("，");
                bos.write(stuList.get(i).getAge());
                bos.write("，");
                bos.write(stuList.get(i).getScore());
                bos.newLine();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
